package pl.edu.agh.inpema.core.model;

public class ProfilePair implements Comparable<ProfilePair> {
	
	private Profile profile1;
	private Profile profile2;
	
	public ProfilePair(Profile profile1, Profile profile2) {
		this.profile1 = profile1;
		this.profile2 = profile2;
	}
	
	public Profile getProfile1() {
		return profile1;
	}
	public void setProfile1(Profile profile1) {
		this.profile1 = profile1;
	}
	public Profile getProfile2() {
		return profile2;
	}
	public void setProfile2(Profile profile2) {
		this.profile2 = profile2;
	}
	
	public int compareTo(ProfilePair pair) {
		int p1Result = this.profile1.compareTo(pair.getProfile1());
		if (p1Result == 0)
			return this.profile2.compareTo(pair.getProfile2());
		else
			return p1Result;
	}
	
	public boolean equals(Object o) {
		ProfilePair p = (ProfilePair) o;
		if (! this.profile1.equals(p.getProfile1()))
			return false;
		if (! this.profile2.equals(p.getProfile2()))
			return false;
		return true;
	}
	
	public int hashCode() {
		return this.profile1.hashCode() + this.profile2.hashCode();
	}
	
}
